<?php
/**
 * PHP Class
 *
 * LICENSE
 *
 * Processing: Bootstrap 
 *
 * @category   	Gnn Cms
 * @package    	Gnn System
 * @copyright  	Copyright vinanewstar.vn@gmail.com
 * @author		GiangNam (vinanewstar.vn@gmail.com)
 * @license    	GNU General Public License Version 2 or later (the "GPL")
 * @version     v1.0 Jun 5, 2013 || 7:56:39 AM
 */
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap{
	/**
	 * Db configuration
	 * @return Ambigous <Zend_Db_Adapter_Abstract, unknown>
	 */
    protected function _initDb(){
	
    	$dbOption = $this->getOption('resources');
    	$dbOption = $dbOption['db'];
    	
        // Setup database
        $db = Zend_Db::factory($dbOption['adapter'],$dbOption['params']);
       
        $db->setFetchMode(Zend_Db::FETCH_ASSOC);
        $db->query("SET NAMES 'utf8'");
        $db->query("SET CHARACTER SET 'utf8'");       
       
        Zend_Registry::set(REGISTRY_KEY_DBO,$db);
                
        //Khi thiet lap che do nay model moi co the su dung duoc
        Zend_Db_Table::setDefaultAdapter($db);
        
        // Return it, so that it can be stored by the bootstrap
        return $db;
       
    }
    
    
    /**
     * Caching definition
     */
    protected function _initCacher(){
    	$info = new Zendvn_System_Info();
    }
    
    /**
     * Load router
     */
    protected function _initLoadRoute(){
    
//     	$filename = APPLICATION_PATH . '/configs/system-router.ini';
//     	$config = new Zend_Config_Ini($filename,'regex-routes');
    
//     	$front = Zend_Controller_Front::getInstance();
//     	$router = $front->getRouter();
//     	$router->addConfig($config,'routes');
    
    }
}
